package cn.zf233.xcloud.commom.enums;

/**
 * Created by zf233 on 2020/1/30
 * 用户状态
 */
public enum UserStatusENUM {

    PHONE_LOGOUT("申请注销", -3),
    PHONE_UNVERIFIED("手机待验", -2),
    EMAIL_UNVERIFIED("邮箱待验", -1),
    LOCK_USER("已锁定", 0),
    NORMAL_USER("正常", 1);

    private final String describe;
    private final Integer code;

    public static UserStatusENUM exists(Integer type) {
        for (UserStatusENUM value : values()) {
            if (value.getCode().equals(type)) {
                return value;
            }
        }
        return null;
    }

    public static String getUserStatusName(Integer type) {
        for (UserStatusENUM value : values()) {
            if (value.getCode().equals(type)) {
                return value.getDescribe();
            }
        }
        return "未知";
    }

    UserStatusENUM(String describe, Integer code) {
        this.describe = describe;
        this.code = code;
    }

    public String getDescribe() {
        return describe;
    }

    public Integer getCode() {
        return code;
    }
}